// pages/myEnterprises/myEnterprises.js
Page({
    /**
     * 页面的初始数据
     */
    data: {
        show: false,
        myCompanyInfo: [{ // 从后台获取
                id: 0,
                name: '诚德',
                desc: '软包装mes'
            },
            {
                id: 1,
                name: '格洛玻',
                desc: 'ERP需求'
            }
        ]
    },

    onLoad() {
        // 从后台获取数据myCompanyInfo
        // ...
    },
    onClose() {
        this.setData({
            show: false
        });
    },


    showPopup() {
        this.setData({
            show: true
        });
    },

    // 查看详情
    bindViewTap(e) {
        const id = e.currentTarget.dataset.id
        wx.navigateTo({
            url: `/pages/Business-details/Business-details?id=${id}`,
        })
    },

    // 企业列表
    onShareAppMessage() {
        return {
            title: 'checkbox',
            path: 'page/component/pages/checkbox/checkbox'
        }
    },

    checkboxChange(e) {
        console.log('checkbox发生change事件，携带value值为：', e.detail.value)

        const items = this.data.items
        const values = e.detail.value
        for (let i = 0, lenI = items.length; i < lenI; ++i) {
            items[i].checked = false

            for (let j = 0, lenJ = values.length; j < lenJ; ++j) {
                if (items[i].value === values[j]) {
                    items[i].checked = true
                    break
                }
            }
        }

        this.setData({
            items
        })
    }


})